<!DOCTYPE html>
<html lang="en" class="no-js" xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout" layout:decorator="layout">
<head>
    <title>优惠券类型管理</title>
</head>
<body>
<div layout:fragment="content">
    <div class="row">
        <div class="col-md-12">
            <div class="btn-group pull-right">
                <a href="index.html" th:href="@{/promotion/coupon/index}" id="link_return" class="btn green">返回<i
                        class="fa fa-arrow-circle-o-left"></i></a>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-md-12">
            <div class="form">
                <form role="form" id="form_grant_underline_edit" th:action="@{/promotion/coupon/grant_underline}"
                       method="post" class="form-horizontal">
                    <input type="hidden" name="couponPromotionId" th:value="${couponPromotion.id}" />
                    <h4 class="form-section">线下发放</h4>
                    <div class="form-body">
                        <div class="form-group" >
                            <label class="control-label col-md-3">类型金额</label>
                            <div class="col-md-4">
                                <label class="control-label" th:text="${couponPromotion.name} + '[￥' + ${#numbers.formatDecimal(couponPromotion.bonusPrice,0,2)} + ']'"></label>
                            </div>
                        </div>
                        <div class="form-group" >
                            <label class="control-label col-md-3">发放数量</label>
                            <div class="col-md-4">
                                <input type="text" id="text_grantNum" name="grantNum" class="form-control" />
                            </div>
                        </div>
                        <div class="form-actions fluid">
                            <div class="col-md-offset-3 col-md-9">
                                <button type="submit" id="bt_submit" name="bt_submit" class="btn blue">确定发送优惠券</button>
                                <!-- <button type="reset" id="btn_reset" name="btn_reset" class="btn default">清空</button> -->
                            </div>
                        </div>
                    </div>
                </form>
            </div>

        </div>
    </div>
</div>
</body>
</html>

<script th:inline="javascript">
    /*<![CDATA[*/
    $(document).ready(function(){
        $("#form_grant_underline_edit").validate({
            rules:{
                grantNum:{
                    required:true,
                    digits:true,
                    max:10000
                }
            },
            messages:{
                grantNum:{
                    required:"请输入发放数量",
                    digits:"请输入正整数",
                    max: "发放数量最多10000张"
                }
            }
        });
    });
    /*]]>*/
</script>